Further shrink the big-lock window.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 27 Mar 2007 15:03:30 +0000 (16:03 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 27 Mar 2007 15:03:30 +0000 (16:03 +0100)
A few more adjustments to when the 'big' lock is taken/dropped.

Also, fix a case where the foreign domain setting may not get properly
cleared at the end of a hypercall (in case of an early error).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm.c

index e0590f33a2a84234dce5fd2a833d79b98023a6aa..aa135c96f4a40f0bff7cbb8fff3936b52efc4a09 100644 (file)
@@ -2431,13 +2431,13 @@ int do_mmu_update(
         guest_handle_add_offset(ureqs, 1);
     }
 
-    domain_mmap_cache_destroy(&mapcache);
-    domain_mmap_cache_destroy(&sh_mapcache);
-
     process_deferred_ops();
 
     UNLOCK_BIGLOCK(d);
 
+    domain_mmap_cache_destroy(&mapcache);
+    domain_mmap_cache_destroy(&sh_mapcache);
+
  out:
     /* Add incremental work we have done to the @done output parameter. */
     if ( unlikely(!guest_handle_is_null(pdone)) )
@@ -2740,6 +2740,10 @@ int do_update_va_mapping(unsigned long va, u64 val64,
         guest_unmap_l1e(v, pl1e);
     pl1e = NULL;
 
+    process_deferred_ops();
+
+    UNLOCK_BIGLOCK(d);
+
     switch ( flags & UVMF_FLUSHTYPE_MASK )
     {
     case UVMF_TLB_FLUSH:
@@ -2785,10 +2789,6 @@ int do_update_va_mapping(unsigned long va, u64 val64,
         break;
     }
 
-    process_deferred_ops();
-    
-    UNLOCK_BIGLOCK(d);
-
     return rc;
 }
 
@@ -2806,6 +2806,9 @@ int do_update_va_mapping_otherdomain(unsigned long va, u64 val64,
 
     rc = do_update_va_mapping(va, val64, flags);
 
+    BUG_ON(this_cpu(percpu_mm_info).deferred_ops);
+    process_deferred_ops(); /* only to clear foreigndom */
+
     return rc;
 }